View Javadoc

1   /*
2    * Copyright (C) 1998-2000 Semiotek Inc.  All Rights Reserved.
3    *
4    * Redistribution and use in source and binary forms, with or without
5    * modification, are permitted under the terms of either of the following
6    * Open Source licenses:
7    *
8    * The GNU General Public License, version 2, or any later version, as
9    * published by the Free Software Foundation
10   * (http://www.fsf.org/copyleft/gpl.html);
11   *
12   *  or
13   *
14   * The Semiotek Public License (http://webmacro.org/LICENSE.)
15   *
16   * This software is provided "as is", with NO WARRANTY, not even the
17   * implied warranties of fitness to purpose, or merchantability. You
18   * assume all risks and liabilities associated with its use.
19   *
20   * See www.webmacro.org for more information on the WebMacro project.
21   */
22  
23  
24  package org.webmacro;
25  
26  import java.io.IOException;
27  
28  /***
29   * Directives, variables, macro calls, blocks, conditions, text, etc., all
30   * have this as their supertype.
31   */
32  public interface Macro
33  {
34  
35      /***
36       * Interpret the directive and write it out, using the values in
37       * the supplied context as appropriate.
38       * <p>
39       * @exception PropertyException if required data was missing from context
40       * @exception IOException if we could not successfully write to out
41       */
42      public void write (FastWriter out, Context context)
43              throws PropertyException, IOException;
44  
45      /***
46       * same as out but returns a String
47       * <p>
48       * @exception PropertyException if required data was missing from context
49       */
50      public Object evaluate (Context context)
51              throws PropertyException;
52  
53  }
54